package config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016091100484906";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCYQTEU0AZk8v+X6vVROjrdA1hRJ80+L6S2jWz36u9HRCDNGc5cCvc/RHxSQkncBnxezeCNCbwfY3hYePVuUXiccbdJk0+t1U0Bje84tn72zVwcA2HQ0gU7BfA4zrIeIFrySG4p1EmdYM9o4cJ7IR+q/G7MdU40IA3NaiAhMlb6QDTQohpv9paS6HS93WniUtksJjrEQF4EGtJPybRSS0FLr5TZ1r3TY3uqlE1fH4vaUz4+MsWUJUEe91zwZLMUdAyI1iF43mEdsfNg+1WNyw5cwCGUOQ2kITxofRDVZXLdQawEnzlr8Zuds8RBV23whORoTHFo22UB6tcNO/FR8HYVAgMBAAECggEAJ8vScmg1Y6mIWUMWwBaCUEaRjRTkNr7pRLYOp3aG+I+8Kx/1qmVLXwQdorqk55fiZj1V1keXHnU3fZiQPjeZWPr4N4kDqKI6MI/S2XYKFaRz0PapWJWsvFK/CXotYGaAnxeDg/dzDmnBjN6FoP11c5HrvBFlUYaXVPvKTiMETQCYFOgr5oSFwGCQJYDXpUwc/upAs94dnJW6QTWpIW0PpHsicO+0gLN75/alhX8SylG0zAvHFLo4bAnszfxSaa3UgiUoyDZOMoY9Et33OzfTpZHsgxtvjc01B3He5EENaSovWeaYy/sp7zwhZEcvQLZntAAIP7xgsHVH1w6RXR9u+QKBgQDImSBai8bBYpCwkU9GXGc7oJhIrSfbI7LaZFuOEUzDsjiES1ed344XUgt0p6vT5nYuI6F8ZaHg43cYJjj2UmHFEqgZTgyGX0RKx3x1ceWhCHWs3A9QAClA8X7LUBdXjkxOwOxh86lYJSuikX/Z6pZvqiqLhmxJdGFoaEppipjPgwKBgQDCTgoXbRo4DGlVUH88oLwHEXBcdrLdwkIG0f70+v2ykdyViDe6acatbtLUaRLu9SQup3TBPRRhbJLgg2BtA5WrM657OEDqivPtJgxmFYOWUPMeagikyMAyZCZRYoPaLUeNNIutMrN6GiQdBKD6VcUz7+bVW/vKCGlMBxfXhwJYhwKBgQCujB+M6kdeCqggG7DBZrIlPk6EHrephVyhj+Xirsb/Gdr3sp9grh/zxt5U+XkYf1aiOzrPBZhgGU2N4+R44aJVWzCOJE3dtpO0BfUUNLE8+CF88lcYo6tB6WENBHnrI9TeShzl9qGKI33ejYCUW/3e2FEA60zadbw0n1rwjzr8hQKBgQC4ym9eiCx/UY57zOq1RkiMkFFEHr9NmAojYmQPqQTOZ1pZ/ArEBwUkvFlWGfgfupSGqkun2+ceIJwvWcLC6r3U7HnsRju21B/YUm9IRv22X5ZYPo+p6CKhyg2HKSIsxRNff7G3LpjybxoZXuWaLyg1lNr731c/dXBvFe/e0k+w0QKBgQC4y148xLuOm7UuEZmV0pstEe0syufYt0WE+SAQoUN2Gfpwb7f/XZucVO4NFEZz91DKMSfEnPtxjGUHpPkFHekhGN2ImtUaSd9A0Kf0jf8lTJkQMvFvZ5s6GtwtqUFHA7Agi3LrLUIT4+uVDTo/3prgiVBglwfN621qryXBKPwCHQ==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqqtAZJ+mbJjsBVg/TxuIIraPDfygMxxIYpxvxue4CYU8dDRVbn19kl0LqBX05N5bG3o3Cfl2vG7wzvcWAcGe3P5y73cJogclH8Ip5sMlvPFua4qi5ECyqWrkZdNE6EXhxDJIiYiXTOqfdSyluNvHgIOq4e54w73WCVvomKBJJpkbdZFRc7v2mCGxXHgg4so0BeNdn5855TTDUaNwwqOY717z4LYiNa/xfrmD5i+Z2/dddnzI74KqudLI4dmkUHlaWSPrpc7rTbzgdw7My+B7mE3VpltxUb8v3DHW6TV5LlRaqXcL9YuuEE0hSFfFaVoVWfnGsO+UyyRpIBMGtVH7wQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://47.104.219.83:8083/zfb/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://47.104.219.83:8083/zfb/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "/usr/local/src/zhifubaologs";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

